package com.osfw.framework.view;

import cn.hutool.core.util.IdUtil;
import com.osfw.framework.utils.http.RequestUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.servlet.view.freemarker.FreeMarkerView;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * FwFreemarkerView 自定义视图，设置全局变量
 */
@Slf4j
public class FwFreemarkerView extends FreeMarkerView {

    @Override
    protected void exposeHelpers(Map<String, Object> model, HttpServletRequest request) throws Exception {
        model.put("ctx", RequestUtil.getBasePath(request));
        model.put("clientId", IdUtil.fastSimpleUUID());
//        model.put("aesKey", IdUtil.fastSimpleUUID());
        super.exposeHelpers(model, request);
    }

}
